Repository navigation
Conversation
…0 first Both flat-view terrain chains (main pass and second pass) put the logic & 0x100 arm first and the rocks/trees arm last, as the original. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
…image first, moat arm without goto 41.1%, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
…a sprite switch The entity pass over a tile is a do-while over nextEntityOnThisTileByID; the sprite switch's cases follow the original's jump-table order, the skip cases set a flag instead of jumping, the zoomed-out case advances and continues, and the batch-scheduling default (which the decompiler had parked after the function's return) sits at the end of the switch. One goto stays: the fire case jumps to the default's schedule call, which the original shares. 41.1%, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
…out goto One rotateByteLeft call per orientation; MSVC merges them into the original's shared call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
…the original's case order Both siege-unit offset switches were still in Ghidra's value order; the original's jump tables put mangonel after shield (found by switch_order.py). Also drops a doubled (int) cast on drawHeight1 (dropcast.py, code-generation neutral). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
…rder levers The big decompiled render functions were held back mostly by block order, and these are the scripts that restored it, cleaned up from the ViewportRenderState session: - switch_order.py: decode the original's jump tables, match each to a source switch, and put the case bodies in target-address order (= source order). Fall-through chains move as one unit, so a reorder cannot change behaviour. Reproduces the hand reorder of renderGmOverlayBuilding (0.40 -> 0.69 quick ratio) without the chopping-block fall-through the hand version introduced. - flip_branches.py: flip if/else arms (inverted comparison, arms exchanged); --find pairs basic blocks against the original and lists the branches laid out the other way round. - dropcast.py + test_dropcast.py: drop (int) casts integral promotion makes redundant, typed from the generated headers. - make_variants.py: write quick_styles variants from (old, new) replacements. - orig_emulate.py: run an original function under unicorn and dump `this`. - quick_diff.py: -r (register-canonical), -l (source lines), --runs N, --sbs A-B; records control flow for flip_branches; argv parsed in main(). - quick_styles.py: exact/reg/fine scores, a (current) baseline row, --rank, and an identical-code marker. - common.py: OriginalImage, shared by quick_diff, switch_order, orig_emulate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmYbLQCBa8ek5RWjimR
This was referenced Nov 19, 2026
gynt
added a commit
that referenced
this pull request
Nov 24, 2026
…d_0x41a as a short (#450) * headers: Unit::field_0x41a is a short It was `undefined2`. Units::UpdateAssassin (0x005744D0) compares it signed in two places, `cmp ax, bx; jle` at 0x00574F12 and `cmp cx, bx; jle` at 0x005750C2 (ebx is 0), each followed by `add ..., -2` and the store back. No other function on main names the field. The only other code that touches it is 0x004E2630 (`movsx` at 0x004E2691), not on main; gynt's #241 has it as renderAssassinClimbingOverlay and makes the same change to this line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x005744D0 100.0% Reimplemented Units::UpdateAssassin, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (7e9039d at 44.69%, after 7ffb455 at 44.69% and 982d7f0 at 39.56%), through versions on our dev branch from 82.5% to 97.0%. The forms that matter: - the melee and wall-attack states have UpdateKnight's shapes: the unit is read through the slot global with no local copy of the unit ID, and the attacked unit's ID is read once into a local in front of playHurtSFXForUnit, its type once into an int behind it; - `building` is declared with its value at the wall attack's tile check (`int building = BuildingLayer[...]`), so no path reads it unassigned; without that assignment the function gets 4 bytes of frame the original does not have; - the fade countdown is decremented as a signed char (`--(char&)...`); - of the wall attack's three give-up places the first and the third only set the state and fall to the case's end, and the second, the AI's give-up on a wall, is the then-arm of its test with the return in the else-arm. The compiler keeps a block with its own copy of the case's end at the first place and jumps into it from the second, as the original does (9 bytes); - the idle state's end in its plain form: `if (dig or fill moat) { idle = 1; } if (idle == 0) { return; } animationCycleNumber = 0;`. The original sets the idle flag behind the two compares and jumps over the flag test (`cmp ax, 6; je; cmp ax, 7; jne; mov [idle], ecx; jmp` from 0x00575506); with the return in an else-if the function is four instructions longer; - field_0x41a is compared as the short it now is in Unit.hpp (the commit before this one), without a cast. The rope chain ends in an else-if / else, no else stands behind a return, and two comments give the why of the then-arm and of the signed decrement; the code is the same (quick_diff, 1058 instructions, line for line). Numbers and pointer arithmetic that have names in main's headers are written with those names, as in UpdateKnight. The states 104 and 105 have no name in UnitState yet and keep their casts. compiler-flags-gl.txt gets UpdateAssassin.cpp. No other line is needed: of its callees, hasUnitReachedDestination and resumeMovementIfNoAttackTarget are on main's list already, and the function reads 100.0% with the list as it is. reccmp in a build of main's whole /GL list (the 133 files that exist) and this file, with the header commit and every resolver of those files on: UpdateAssassin 100.0% raw and normalised, no differing line. Each of the 143 functions of main's list reads the same as in the same build of main (3458fea) without the header commit and the file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Gynt <gynt@users.noreply.github.com>
Main merged #392, which carries this branch's 100% ViewportRenderState functions in a later, restyled form (named constants, Ghidra field renames). - Headers (Globals INT_00ed314c/INT_00ed3154, ColorUnion.hpp, ViewportRenderState.hpp): main's version. - The 16 .cpp files both sides added (add/add) are functions main already has at 100% (including renderDebugDataMousePointing, 86.9% here): main's version. - status: main's lines, plus this branch's partial entries that main still had as Pending. - compiler-flags-gl.txt: main's list plus this branch's three resetupViewport/setupViewport/setViewportBasedOnMapSize lines. - tools: quick_diff.py keeps this branch's main()-based CLI (-r/-l/--runs/ --sbs) and gains main's -d and --name; d/ibase/secs/off stay module-level so main's quick_gl.py can still point the disassembler at its DLL. quick_styles.py keeps the three-score table and adopts main's rule that the source as it stands wins a tie. README rows combined. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Follow main's Ghidra renames in the five sources main does not have: - ViewportState::mouseTile -> mouseFlatTile - Building::field_0xc2 -> targetMarker (with the BTM_* constants) - DAT_00ed314c / DAT_00ed3154 -> INT_00ed314c / INT_00ed3154 - Entity, Floater, Tree, TextManager and ViewportRenderState field renames in renderMap (refactor_struct_fields.py) - ColorUnion has no ushortValue view on main: read COL_MAGENTA through (ushort)shortValue instead of changing the header. All 18 functions that were 100% before the merge are still 100%; the partial ones keep their raw match (renderMap normalized 41.4 -> 40.9). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Dec 2, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…0x64 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…regs Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ions setupViewport, computeMouseTileFromScreenPosition and renderAssassinClimbingOverlay keep their percentages; the remarks now name what stops each one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.